#!/bin/bash
export LANG=zh_CN.UTF-8
PRESTO_HOME=/export/server/presto/bin/presto
MYSQL_HOME=/usr/bin/mysql

${MYSQL_HOME} -h192.168.88.80 -p3306 -uroot -p123456 -e "
CREATE DATABASE IF NOT EXISTS edu_check DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
use edu_check;
drop table if exists edu_check.hkl_rpt_studying_timecnt;
drop table if exists edu_check.hkl_rpt_late_timecn;
drop table if exists edu_check.hkl_rpt_leave_timecnt;
drop table if exists edu_check.hkl_rpt_truant_timecnt;"

${PRESTO_HOME} --catalog hive --server 192.168.88.80:8090 --execute "


create table mysql.edu_check.hkl_rpt_studying_timecnt
as
select * from hive.edu_rpt.hkl_rpt_studying_timecnt;

create table mysql.edu_check.hkl_rpt_late_timecn
as
select * from hive.edu_rpt.hkl_rpt_late_timecn;

create table mysql.edu_check.hkl_rpt_leave_timecnt
as
select * from hive.edu_rpt.hkl_rpt_leave_timecnt;

create table mysql.edu_check.hkl_rpt_truant_timecnt
as
select * from hive.edu_rpt.hkl_rpt_truant_timecnt;"

